package ooday03;

public class AnimalTest {
    public static void main(String[] args) {

        Dog[] dogs = new Dog[3];
        dogs[0] = new Dog("小黑", 3, "黑");
        dogs[1] = new Dog("小白", 1, "白");
        dogs[2] = new Dog("小灰", 2, "灰");
        System.out.println(dogs[0].name);
        dogs[1].age = 4;
        dogs[2].Swim();

        for (int i = 0; i < dogs.length; i++) {
            System.out.println(dogs[i].name);
            dogs[i].eat();
        }
        System.out.println(" ");

        Chick[] chicks = new Chick[3];
        chicks[0] = new Chick("小黑", 2, "黑");
        chicks[1] = new Chick("小黄", 6, "白");
        chicks[2] = new Chick("小白", 4, "黄");

        for (int i = 0; i < chicks.length; i++) {
            System.out.println(chicks[i].name);
            chicks[i].eat();
            chicks[i].egg();
        }

        System.out.println(" ");
        Fish[] fish = new Fish[3];
        fish[0] = new Fish("金金", 5, "金");
        fish[1] = new Fish("咕咕", 7, "红");
        fish[2] = new Fish("哈哈", 2, "绿");

        for (int i = 0; i < fish.length; i++) {
            System.out.println(fish[i].name);
            fish[i].eat();
            fish[i].Swim();


        }


    }
}


